package com.xgd.phylw.service.impl;

import com.xgd.phylw.bean.Orderd;
import com.xgd.phylw.bean.OrderdExample;
import com.xgd.phylw.dto.OrderScheduleMovieHallDto;
import com.xgd.phylw.mapper.OrderdMapper;
import com.xgd.phylw.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderdMapper orderdMapper;

    public int insertByOrder(List<Orderd> orderdList) {
        return orderdMapper.insertByOrder(orderdList);
    }

    public int returnTicketByOrder(Orderd orderd){
        return orderdMapper.updateByPrimaryKeySelective(orderd);
    }

    public int deleteByOrder(int[] checkIdArray) {
        return orderdMapper.deleteByPrimaryKeyArray(checkIdArray);
    }

    public List<Orderd> selectOrderByMemberName(String memberName) {
        OrderdExample orderdExample = new OrderdExample();
        orderdExample.createCriteria().andMemberNameEqualTo(memberName);
        return orderdMapper.selectByExample(orderdExample);
    }

    public List<OrderScheduleMovieHallDto> selectByMemberName(String memberName) {
        return orderdMapper.selectByMemberName(memberName);
    }

    public List<Orderd> Order(String val) {
        return orderdMapper.likeOrderd("%"+val+"%");
    }
}
